package com.yulongtian.offers.day202212;

/**
 * @author yulongTian
 * @create 2022-12-16 10:52
 */
public class Test05 {
    public static void main(String[] args) {

    }

    public ListNode detectCycle(ListNode head) {



        ListNode point = head;
        int BASE = 100001;
        int index = 0;

        while (true) {
            if (point == null) {
                return null;
            }

            if (point.val >= BASE) {
                return point;
            }
            point.val = BASE + index;
            index++;
            point = point.next;
        }


    }


    class ListNode {
        int val;
        ListNode next;

        ListNode(int x) {
            val = x;
            next = null;
        }
    }

}
